<template>
  <div class="login-type">
    <nav-header></nav-header>
    <div class="login-type-content">
      <el-form ref="loginType_form" label-position="top">
        <el-form-item label="视频防盗录设置">
          <el-radio-group v-model="loginType_form.type">
            <el-radio :label='1'>开启</el-radio>
            <el-radio :label='2'>关闭</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item>
          <el-button size="small" type="primary" @click.stop="changeLoginType">保存</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      loginType_form: {
        type: '',
      },
    }
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      this.getLoginType();
    },
    getLoginType() {
      let success = (res => {
        this.loginType_form.type = res.data.safe_show;
      })
      let params = {
        type: 3
      }
      this.$ajax.get('api/video/live_app_show', {params,  func: { success } })
    },
    changeLoginType() {
      let success = (res => {
        this.$message.success(res.msg);
        this.init();
        // this.$message.success(data.msg);
      })
      this.$ajax.put('api/video/live_app_show', { type: 3, status: this.loginType_form.type }, { func: { success, } })
    },
  }
}
</script>

<style>
.login-type-content {
  border-bottom: 1px solid #e6e6e6;
  margin-bottom: 20px;
}
</style>